ObjectDB Database Search

1-50 of 200 results

JPA Named Queries

A named query is a statically defined query with a predefined unchangeable query string. Using named queries instead of dynamic queries may improve code organization by separating the JPQL ... : @NamedQuery ( name ="Country.findAll", query ="SELECT c FROM Country c") The  @NamedQuery annotation

Query Parameters in JPA

execution, because it eliminates the need for repeated query compilations. Named Parameters (: name ... getCountryByName( EntityManager em, String name ) { TypedQuery query = em. createQuery ( "SELECT c FROM Country c WHERE c. name = : name ", Country.class); return query . setParameter (" name ", name

JPA Criteria API Queries

queries (e.g. as named queries ) may be preferred. For dynamic queries that are built at runtime -  ... The JPA Criteria API provides an alternative way for defining JPA queries , which is mainly useful for building dynamic queries whose exact structure is only known at runtime. JPA Criteria API vs

Setting and Tuning of JPA Queries

", 6000); For a  named query definition - using the hints  element: @NamedQuery ( name ="Country.findAll", query ="SELECT c FROM Country c",      hints ={@ QueryHint ( name ... The  Query and  TypedQuery interfaces define various setting and tuning methods

Running JPA Queries

the country names , a query using projection and retrieving country names directly instead ... = em. createQuery ( "SELECT c FROM Country c WHERE c. name = 'Canada'"); Country c = (Country) query ... The Query interface defines two methods for running SELECT queries : Query .getSingleResult

JPA Query API

and Named Queries Building queries by passing JPQL query strings directly to the createQuery method, as ... also provides a way for building static queries , as named queries , using the @NamedQuery and @NamedQueries annotations. It is considered to be a good practice in JPA to prefer named queries

JPA Query Structure (JPQL / Criteria)

The syntax of the Java Persistence Query Language (JPQL) is very similar to the syntax of SQL. Having an SQL-like syntax in JPA queries is an important advantage because SQL is a very powerful query ... classes and objects. For example, a JPQL query can retrieve and return entity objects

UPDATE SET Queries in JPA/JPQL

;within an active transaction. Applying changes to the database by calling the commit method. JPQL UPDATE queries provide an alternative way of updating entity objects. Unlike SELECT queries , which are used to retrieve data from the database, UPDATE queries do not retrieve data from the database

Literals in JPQL and Criteria Queries

). JPQL literals should be used sparingly as queries that use parameters instead of literals ... parameter values. Literals should only be embedded in JPQL queries when a single constant value ... '} Enum Literals JPA 2 adds support for enum literals. Enum literals in JPQL queries use

Strings in JPQL and Criteria Queries

String values may appear in JPQL queries in various forms: as  string literals - e.g. 'abc ... (usually a parameter or literal). For example: c. name LIKE '_r%' is TRUE for 'Brazil' and FALSE for 'Denmark' c. name LIKE '%' is always TRUE (for any c. name value). c. name NOT LIKE '%' is always FALSE

Chapter 4 - JPA Queries (JPQL / Criteria)

( named ) queries . It explains how to use the relevant interfaces, annotations, enums and methods ... The JPA Query Language (JPQL) can be considered as an object oriented version of SQL. Users ... well as how to use the JPA Criteria API, which provides an alternative way for building queries in JPA

JPA Annotations for JPQL Queries

The following annotations are used to define static named JPA queries : The JPA Named Queries section of the ObjectDB Manual explains and demonstrates how to use these annotations to define named JPQL queries .

JPA Queries

Queries are represented in JPA by the Query and TypedQuery interfaces: The JPA Query API ... these interfaces to build and run JPQL queries . The TypedQuery interface (or alternatively the older Query interface) is the only neccessary interface for defining and running string based JPQL queries  

SELECT clause (JPQL / Criteria API)

path expressions , such as c. name , in query results is referred to as projection. The field values ... c. name FROM Country AS c", String.class); List results = query . getResultList (); Only singular ... query retrieves the name of the capital city of a specified country: SELECT c.capital. name FROM

DELETE Queries in JPA/JPQL

DELETE queries provide an alternative way for deleting entity objects. Unlike SELECT queries , which are used to retrieve data from the database, DELETE queries do not retrieve data from ... from the database using a DELETE query may be slightly more efficient than retrieving entity objects

JPA Query Expressions (JPQL / Criteria)

Query expressions are the foundations on which JPQL and criteria queries are built. Every query ... of JPQL / Criteria query expressions. Atomic Expressions The atomic query expressions are: JPQL / Criteria Variables JPQL / Criteria Parameters JPQL / Criteria Literals Every query expression consists

Criteria Query Selection and Results

and for representing query results as tuples. SELECT Clause Elements The content of the SELECT clause in a criteria query is represented by Selection : Because Selection  is a super interface ... of Selection : See the SELECT in Criteria Queries section for more details and examples. ORDER BY

Criteria Query From Elements

The interfaces in this group are in use for setting a criteria query FROM clause. Criteria Query Variables The FROM clause  in JPA queries (as in SQL) defines the query variables. Query variables are represented in criteria queries by descendant interfaces of the From interface: Range

Date and Time in JPQL and Criteria Queries

Date and time expressions may appear in JPQL queries : as date and time literals - e.g. {d '2011-12 ... that are evaluated to the date and time on the database server when the query is executed: CURRENT_DATE ... to 0 . Date and Time in Criteria Queries The CriteriaBuilder interface provides three factory methods

Collections in JPQL and Criteria Queries

Collections may appear in JPQL queries : as parameters - when collections are assigned as arguments ... that is passed to the query as a parameter. For example: 'English' IN :languages is TRUE if the argument ... are treated as synonyms. Criteria Query Collection Expressions JPQL collection operators and functions

Numbers in JPQL and Criteria Queries

Numeric values may appear in JPQL queries in many forms: as  numeric literals - e.g. 123 ... . Criteria Query Arithmetic Expressions JPQL arithmetic operators and functions (which are described above) are available also as JPA criteria query expressions. The CriteriaBuilder interface provides

Criteria Query Expressions

The following interfaces are in use in representing general expressions in criteria queries : See the Query Expressions section for more details and examples.

JPA Annotations for SQL Queries

The following JPA annotations are designated for SQL queries on relational databases: ObjectDB supports only the preferred JPA query language, JPQL, and silently ignores all the above annotations.

FROM clause (JPQL / Criteria API)

, and the same query can also be written as follows: SELECT c FROM Country c By default, the name of an entity class in a JPQL query is the unqualified name of the class (e.g. just Country with no package ... name annotation element. Multiple range variables are allowed. For example, the following query

jakarta.persistence.Query

is not required to be supported for native queries . Parameters: name - parameter name Returns: parameter ... is required to be supported for criteria queries only. Parameters: name - parameter name type - type ... - name of the property or hint Returns: the same query instance. Throws: IllegalArgumentException

jakarta.persistence.Entity.name

Jakarta Persistence (JPA) Method in jakarta.persistence.Entity String name (Optional) The entity name . Defaults to the unqualified name of the entity class. This name is used to refer to the entity in queries . The name must not be a reserved literal in the Jakarta Persistence query language. Default: "" Since: Jakarta Persistence (JPA) 1.0

jakarta.persistence.NamedStoredProcedureQuery.name

Jakarta Persistence (JPA) Method in jakarta.persistence.NamedStoredProcedureQuery String name The name used to refer to the query with the EntityManager methods that create stored procedure query objects. Since: Jakarta Persistence (JPA) 1.0

jakarta.persistence.NamedNativeQuery.name

Jakarta Persistence (JPA) Method in jakarta.persistence.NamedNativeQuery String name The name used to identify the query in calls to EntityManager.createNamedQuery . Since: Jakarta Persistence (JPA) 1.0

jakarta.persistence.NamedQuery.name

Jakarta Persistence (JPA) Method in jakarta.persistence.NamedQuery String name (Required) The name used to identify the query in calls to EntityManager.createNamedQuery . Since: Jakarta Persistence (JPA) 1.0

jakarta.persistence.SqlResultSetMapping.name

Jakarta Persistence (JPA) Method in jakarta.persistence.SqlResultSetMapping String name The name given to the result set mapping, and used to refer to it in the methods of the Query and StoredProcedureQuery APIs. Since: Jakarta Persistence (JPA) 1.0

jakarta.persistence.ColumnResult.name

Jakarta Persistence (JPA) Method in jakarta.persistence.ColumnResult String name (Required) The name of a column in the SELECT clause of a SQL query Since: Jakarta Persistence (JPA) 1.0

ORDER BY clause (JPQL / Criteria API)

Expressions The following query returns names of countries whose population size ... BY c. name DESC Grouping (GROUP BY) Order The ORDER BY clause is always the last in the query ... The ORDER BY clause specifies a required order for the query results. Any JPQL query that does not

GROUP BY and HAVING clauses

(which does not use aggregates) is equivalent to the following query : SELECT DISTINCT SUBSTRING(c. name , 1 ... (numeric, strings, dates). The following query counts for every letter the number of countries with names ... SUBSTRING(c. name , 1, 1); The query returns Object[] arrays of length 3, in which the first cell contains

Paths and Types in JPQL and Criteria API

). Navigation through a NULL value The following query retrieves country names with their capital city names ... , string, date). Simple type values are more useful in queries . They have special operators ... . For example, c.capital. name is a nested path expression that continues from the Capital entity object

jakarta.persistence.EntityManagerFactory.addNamedQuery(String,Query)

(    String name ,    Query query ) Define the query , typed query , or stored procedure query as a named query such that future query objects can be created from it using ... of the query object (except for actual parameter binding) in effect when the named query is added

JPA Persistable Types

, package or private) and it can be either concrete or abstract. Entity Class Names Entity classes are represented in queries by entity names . By default, the entity name is the unqualified name of the entity class (i.e. the short class name excluding the package name ). A different entity name

JPA Entity Fields

of the following query : SELECT e FROM Employee e WHERE e.department = :d ORDER BY e. name The specified field ... after retrieval by a special automatic query . Note : Navigation through inverse fields is much less efficient than navigation through ordinary persistent fields, since it requires running queries . Inverse

jakarta.persistence.Query.getParameter(String,Class)

Jakarta Persistence (JPA) Method in jakarta.persistence. Query Parameter getParameter (    String name ,    Class type ) Get the parameter object corresponding to the declared parameter of the given name and type. This method is required to be supported for criteria queries

jakarta.persistence.StoredProcedureQuery

: IllegalArgumentException - if the parameter name does not correspond to a parameter of the query or is not ... required to be supported for native queries . Inherited from Query Parameters: name - parameter name ... parameter. (Note that OUT parameters are unbound.) Inherited from Query Parameters: name - parameter

ObjectDB Object Database Features

Criteria Query API . Static definition ( named queries ) in annotations (@NamedQuery) and XML. Query ... , derived attributes, grouping queries and aggregate queries ) which are usually missing from Object Oriented ... . Query program cache (for repeating queries with different arguments). Query result cache (for repeating

Database Explorer

to view data in ObjectDB databases, execute JPQL and JDOQL queries and edit the content of databases ... and embeddable classes) in the database and their persistent fields and indexes. The [ Query ] window enables running JPQL and JDOQL queries , as discussed below. Closing a Database Connection Use the File Close

jakarta.persistence.Query.setParameter(String,Calendar,TemporalType)

- if the parameter name does not correspond to a parameter of the query or if the value argument is of incorrect ... Jakarta Persistence (JPA) Method in jakarta.persistence. Query Query setParameter (    String name ,    Calendar value ,    TemporalType temporalType ) Bind an instance

jakarta.persistence.Query.setParameter(String,Date,TemporalType)

name does not correspond to a parameter of the query or if the value argument is of incorrect type ... Jakarta Persistence (JPA) Method in jakarta.persistence. Query Query setParameter (    String name ,    Date value ,    TemporalType temporalType ) Bind an instance

jakarta.persistence.Query.setParameter(String,Object)

: name - parameter name value - parameter value Returns: the same query instance. Throws: IllegalArgumentException - if the parameter name does not correspond to a parameter of the query or if the argument is of incorrect type. Since: Jakarta Persistence (JPA) 1.0 ... Jakarta Persistence (JPA) Method in jakarta.persistence. Query Query setParameter (   

jakarta.persistence.Query.getParameter(String)

Jakarta Persistence (JPA) Method in jakarta.persistence. Query Parameter getParameter (    String name ) Get the parameter object corresponding to the declared parameter of the given name . This method is not required to be supported for native queries . Parameters: name - parameter name

jakarta.persistence.Query.getParameterValue(String)

Jakarta Persistence (JPA) Method in jakarta.persistence. Query Object getParameterValue (    String name ) Return the input value bound to the named parameter. (Note that OUT parameters are unbound.) Parameters: name - parameter name Returns: parameter value. Throws: IllegalStateException

jakarta.persistence.Query.setHint(String,Object)

Jakarta Persistence (JPA) Method in jakarta.persistence. Query Query setHint (    String hintName ,    Object value ) Set a query property or hint. The hints elements may be used to specify query properties and hints. Properties defined by this specification must be observed by

Database Management Settings

when the database is closed. The name of the recovery file is based on the name of the database file ... (which modify the database) have to be recorded. For debugging of query failure ... to accelerate the execution of relevant queries . The element The element specifies settings

jakarta.persistence.TypedQuery

of the given name . This method is not required to be supported for native queries . Inherited from Query Parameters: name - parameter name Returns: parameter object. Throws: IllegalStateException ... parameter of the given name and type. This method is required to be supported for criteria queries

Database Connection using JPA

for Query instances, which are needed for executing queries on the database. Every JPA implementation ... an argument a name of a persistence unit . As an extension, ObjectDB enables specifying a database URL (or ... a persistence unit name . To use ObjectDB embedded directly in your application (embedded mode